package shop;

import commodity.Commodity;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Vector;

/**
 * @author Wray
 */
public class DateTransform {
//	Commodity commodity;
//
//	public Commodity getCommodity() {
//		return commodity;
//	}
//
//	public void setCommodity(Commodity commodity) {
//		this.commodity = commodity;
//	}
	
//	public Commodity productTransform(Vector<Object> v) {//将单行表格信息转化为一个商品信息
//		String id = (String) v.get(0);
//		String name = (String) v.get(1);
//		double price = Double.parseDouble(v.get(2).toString());
//		int num = Integer.parseInt(v.get(3).toString());
//		commodity =new Commodity(name, price, num);
//		return commodity;
//	}

	public static void changeList(HashMap<Commodity,Integer>mallHashMap, Vector<Vector<Object>> date) //将商品信息从HashMap转化为Vector，用于表格显示
	{
		// TODO Auto-generated method stub

		for(Commodity commodity : mallHashMap.keySet()){
			Vector<Object> row=new Vector<Object>();
			row.add(commodity.getName());
			row.add(commodity.getPrice());
			row.add(mallHashMap.get(commodity));
			date.add(row);
		}
	}
	
}
